package com.ng.controller;


import com.ng.entity.CJFDBASEYEAR;
import com.ng.entity.CJFXCLS;
import com.ng.entity.DJCLS;
import com.ng.servive.CjfxBaseService;
import com.ng.common.utils.PageUtils;
import com.ng.common.utils.R;
import com.ng.entity.CJFXBASEINFO;
import com.ng.servive.CjfxClsService;
import com.ng.servive.DJCLSService;
import com.ng.servive.cjfxyearService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author cb
 * @Description TODO
 * @date 2023/3/5
 */
@RestController
@RequestMapping("/cjfx")
public class CjfxController {

    @Autowired
    private CjfxBaseService cjfxBaseService;


    @Autowired

    private cjfxyearService  cjfxyearservice;

    @Autowired
    private DJCLSService  djclsService;

    @Autowired
    private CjfxClsService cjfxClsService;

    @RequestMapping("/getlist")
    public R<PageUtils> list (CJFXBASEINFO entity , PageUtils page) {
        PageUtils  pageData= cjfxBaseService.queryPage(entity,page);
        return R.ok(PageUtils.class).setData( pageData);
    }
    @RequestMapping("/findone")
    public R<CJFXBASEINFO> findone (CJFXBASEINFO entity) {
       CJFXBASEINFO  pageData= cjfxBaseService.findone(entity);
       List<CJFDBASEYEAR>bb=cjfxyearservice.Getyears(pageData.getPinyinName());
       pageData.setYears(bb);
        return R.ok(CJFXBASEINFO.class).setData(pageData);
    }
   @RequestMapping("/selectyear")
    public  R<List>  getyearbypykm(CJFDBASEYEAR cjfdbaseyearinfo){
       List<CJFDBASEYEAR> list=new ArrayList<>();
       list=cjfxyearservice.getyearbypykm(cjfdbaseyearinfo);
       return  R.ok(List.class).setData(list);
    }


    @RequestMapping("/getdjcls")
    public  R<List>  getdjcls(DJCLS cjfdbaseyearinfo){
        List<DJCLS> list=new ArrayList<>();
        list=djclsService.querycls(cjfdbaseyearinfo);
        return  R.ok(List.class).setData(list);
    }

    @RequestMapping("/getcjfxcls")
    public  R<List>  getcjfxcls(CJFXCLS cjfdbaseyearinfo){
        List<CJFXCLS> list=new ArrayList<>();
        list=cjfxClsService.querycls(cjfdbaseyearinfo);
        return  R.ok(List.class).setData(list);
    }


}
